[In-app Purchases]Use environment variable to get test site id for IAP #8111
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #8110
Description
Previously, we used the default app site id when debugging In-App purchases and plans, which didn't make much sense because that site was either a wp.com with an e-commerce plan active or a self-hosted site, and thus not eligible for new plans.
When testing IAP plans, we want a wp.com site without a plan, so, to test that, we have added a Xcode environment variable in this PR. This way we can easily set the site id we want to use to that environment variable and test the whole process.
Testing instructions
No test id set
Run the app without setting a site id in the environment variable, or entering it with the wrong format e.g string. Go to the IAP Debug menu. After the products are loaded, you should see the warning explaining that the site couldn't be retrieved, and you shouldn't be able to purchase any product:
Test id set
If you set a valid site id, the IAP Debug screen should show the products and you should be able to trigger a product purchase with the site id set in the environment variable. To verify that that, you can set a breakpoint in InAppPurchasesForWPComPlansManager.swift,
func purchaseProduct(with id: String, for remoteSiteId: Int64) async throws, and inspect theremoteSiteIdvariable.Screenshots
See above
RELEASE-NOTES.txtif necessary.